﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace QuizzService
{
    public static class Helpers
    {
        private static readonly Random rnd = new Random();

        /// <summary>
        /// Gets a random object in an collection
        /// </summary>
        public static T Random<T>(this IEnumerable<T> ienum)
        {
            return ienum.Skip(rnd.Next(ienum.Count())).FirstOrDefault();
        }
    }
}